package main

import "fmt"
/** 定义结构类型 **/
type Books  struct{
	title string
	author string
	subject string
	book_id int
}
/**主函数**/
func main(){
	var book1 Books
	var book2 Books

	book1.title ="Go  语言"
	book1.author= "技术狼"
	book1.subject="Go 语言教程"
	book1.book_id=1

	book2.title = "Python 语言"
	book2.author = "技术狼"
	book2.subject="Python 语言教程"
	book2.book_id = 2

	//普通调用【值传递】
	printGnneralBook(book1)
	//指针调用【引用传递】
	printPointerBook(&book2)
	
}
/** 普通调用 **/
func printGnneralBook(book Books)  {
	fmt.Printf( "Book title : %s\n", book.title)
	fmt.Printf( "Book author : %s\n", book.author)
	fmt.Printf( "Book subject : %s\n", book.subject)
	fmt.Printf( "Book book_id : %d\n", book.book_id)
}
/** 指针调用 **/
func printPointerBook(book *Books)  {
	fmt.Printf( "Book title : %s\n", book.title)
	fmt.Printf( "Book author : %s\n", book.author)
	fmt.Printf( "Book subject : %s\n", book.subject)
	fmt.Printf( "Book book_id : %d\n", book.book_id)
}
